# 设置Git环境变量
$env:Path += ";C:\Program Files\Git\bin"

# 验证Git安装
try {
    $gitVersion = git --version
    Write-Host "Git版本: $gitVersion"
} catch {
    Write-Host "Git未正确安装或环境变量设置失败"
    pause
    exit 1
}

# 配置Git用户信息
git config --global user.name "yuzh0618"
git config --global user.email "yuzh0618@126.com"

# 初始化Git仓库
git init

# 添加远程仓库
git remote add origin https://gitee.com/yuzh0618/mess-mcp.git

# 添加所有文件
git add .

# 提交代码
git commit -m "Initial commit"

# 推送代码到远程仓库
try {
    git push -u origin master
    Write-Host "代码提交成功！"
} catch {
    Write-Host "代码提交失败，请检查网络连接和Gitee凭证"
}

pause